Skip to content

Bitcore-cli XRP updates#4184

Open
kajoseph wants to merge 21 commits into
bitpay:masterfrom
kajoseph:bitcoreCli
Open

Bitcore-cli XRP updates#4184
kajoseph wants to merge 21 commits into
bitpay:masterfrom
kajoseph:bitcoreCli

Conversation

@kajoseph

@kajoseph kajoseph commented Jun 9, 2026

Copy link
Copy Markdown
Collaborator

Description

Bitcore-CLI is missing some important XRP functionality - namely, sending with a destination tag and setting account flags.

Changelog

  • Adds support for setting transaction flags for XRP accounts.
  • Adds support for sending XRP with a dest tag.
  • Upgrades @clack/prompts out of alpha. (Note, this replaced picocolors with fast-wrap-ansi for the terminal coloring which required a few test/CI config changes)

Testing Notes

  • Main menu should show a Flags advanced option for XRP wallets only
  • Flags should show you current account flags
  • Flags should allow you to choose account flags to set
  • Choosing flags to set in Flags should flow cleanly into the tx creation flow (with account and amount pre set).
  • The --help for the flags command should also show transaction options (e.g. bin/wallet <name> --command flags --help)
  • Send should prompt you for an optional destination tag for XRP wallets only

Checklist

  • I have read CONTRIBUTING.md and verified that this PR follows the guidelines and requirements outlined in it.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds missing XRP functionality across the stack (BWS → BWC → bitcore-cli) to (1) manage XRP AccountSet flags and (2) allow sending XRP with an optional destination tag, plus related CLI UX/help updates and dependency bumps.

Changes:

  • Adds XRP account-flag support: BWS /v1/flags endpoint + BWC client method + CLI “Flags” advanced menu/command that can create an AccountSet tx.
  • Adds XRP destination-tag prompting/CLI option support in the transaction flow.
  • Updates XRP tx-building to support AccountSet via txType and comma-delimited flag parsing; bumps @clack/prompts and adds Node engine constraint for bitcore-cli.

Reviewed changes

Copilot reviewed 16 out of 18 changed files in this pull request and generated 11 comments.

Show a summary per file
File Description
packages/crypto-wallet-core/src/utils/index.ts Adds normalizeXrpFlag() helper for XRP flag normalization/validation.
packages/crypto-wallet-core/src/transactions/xrp/index.ts Adds txType support (incl. AccountSet) and string flag parsing for XRP transactions.
packages/bitcore-wallet-service/src/lib/server.ts Passes flags into tx proposal creation; adds getFlags() service method.
packages/bitcore-wallet-service/src/lib/routes/wallets.ts Adds authenticated GET /v1/flags route.
packages/bitcore-wallet-service/src/lib/model/txproposal.ts Persists flags on tx proposals.
packages/bitcore-wallet-service/src/lib/common/utils.ts Minor typing/doc fix for strip().
packages/bitcore-wallet-service/src/lib/blockchainexplorers/v8.ts Adds V8 explorer getFlags() and response-error scrubbing helper.
packages/bitcore-wallet-client/src/lib/api.ts Normalizes outgoing XRP flags; adds getAccountFlags() client method and tx option typings.
packages/bitcore-cli/types/wallet.d.ts Extends wallet typing with XRP getAccountFlags().
packages/bitcore-cli/src/wallet.ts Implements getAccountFlags() in CLI wallet wrapper.
packages/bitcore-cli/src/prompts.ts Adds promptXrpFlag() multiselect prompt for flag toggling.
packages/bitcore-cli/src/commands/transaction.ts Adds CLI support for --flags and destination --tag, plus XRP tag prompt in interactive flow.
packages/bitcore-cli/src/commands/index.ts Exports new flags command.
packages/bitcore-cli/src/commands/flags.ts New CLI command to view/toggle XRP flags and create AccountSet tx proposals.
packages/bitcore-cli/src/cli.ts Wires flags into the command dispatcher.
packages/bitcore-cli/src/cli-commands.ts Adds “Flags” option to Advanced menu for XRP wallets.
packages/bitcore-cli/package.json Adds Node engine constraint; bumps @clack/prompts.
packages/bitcore-cli/package-lock.json Lockfile updates for the dependency bump and bin name.
Files not reviewed (1)
  • packages/bitcore-cli/package-lock.json: Language not supported

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread packages/bitcore-cli/src/commands/flags.ts
Comment thread packages/bitcore-cli/src/wallet.ts
Comment thread packages/bitcore-wallet-service/src/lib/model/txproposal.ts
Comment thread packages/bitcore-wallet-service/src/lib/model/txproposal.ts
Comment thread packages/crypto-wallet-core/src/transactions/xrp/index.ts
Comment thread packages/bitcore-wallet-service/src/lib/blockchainexplorers/v8.ts
Comment thread packages/bitcore-wallet-service/src/lib/routes/wallets.ts Outdated
Comment thread packages/bitcore-cli/src/prompts.ts
Comment thread packages/crypto-wallet-core/src/transactions/xrp/index.ts
Comment thread packages/bitcore-cli/src/commands/transaction.ts
@kajoseph kajoseph requested a review from MichaelAJay June 10, 2026 18:17
@kajoseph kajoseph added BWC This pull request modifies the bitcore-wallet-client package BWS This pull request modifies the bitcore-wallet-service package bitcore-cli This pull request modifies the bitcore-cli package CWC This pull request modifies the crypto-wallet-core package labels Jun 10, 2026
Comment thread packages/crypto-wallet-core/src/utils/index.ts Outdated

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Issue

In direct --command flags flow: getOrSetFlags() calls flags.command(), which delegates to transaction.command() & registers/parses transaction options on the global Commander program. If --flags is provided, it then calls createTransaction(args) while opts.command is still truthy, so createTransaction() calls transaction.command() again and Commander attempts to register the same options twice.

To observe

  1. Create fresh XRP wallet & fund
  2. Run with --command flags --flags tfRequireDestTag
  3. Observe error: "Cannot add option..."

Notes

The first parse in getOrSetFlags() is necessary to read in --flags. So createTransaction() should be flexible enough to not try to parse again.

@MichaelAJay MichaelAJay Jun 29, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Recommendation (confirmed it works) - look for a 'skipCommandParse' flag in the commands/transaction.ts createTransaction() method, and add that :

  if (opts.command && !opts.skipCommandParse) {
    Object.assign(opts, command(args));
  }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bitcore-cli This pull request modifies the bitcore-cli package BWC This pull request modifies the bitcore-wallet-client package BWS This pull request modifies the bitcore-wallet-service package CWC This pull request modifies the crypto-wallet-core package

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants